VERSION 0.6
FROM golang:1.24

build:
  WORKDIR /build
  RUN apt install -y git
  RUN apt install -y binutils
  COPY go.mod .
  COPY *.go .
  COPY api_serv api_serv
  COPY cmds cmds
  COPY config config
  COPY dao dao
  COPY notice_serv notice_serv
  RUN go env -w GOPRIVATE="gitee.com,jihulab.com,atomgit.com,gitcode.com"
  RUN go env -w GOPROXY="https://goproxy.cn,direct"
  RUN go mod tidy
  RUN go build -o server
  RUN strip server
  SAVE ARTIFACT server

docker:
  FROM ubuntu
  ARG TAG="latest"
  WORKDIR /app
  RUN apt update
  RUN apt install -y ca-certificates
  COPY +build/server .
  COPY server.yaml .
  ENTRYPOINT /app/server --config /app/server.yaml serv
  SAVE IMAGE --push ccr.ccs.tencentyun.com/lvup/api-server:$TAG 
